import { deleted, get, post, put } from "../utils/http/index";
import type { IResponse } from "./types";
interface Category {
  cid: number;
  classification: string;
  createTime: string;
  deleted: string;
}
export function getCategory() {
  return get<IResponse>({
    url: "/category",
  });
}
export function getCategoryOne(cid: number) {
  return get<IResponse>({
    url: `/category/${cid}`,
  });
}
export function modifyCategory(category: Category) {
  return put<IResponse>({
    url: "/category",
    data: category,
  });
}
export function deleteCategory(cid: number) {
  return deleted<IResponse>({
    url: `/category/${cid}`,
  });
}
export function addCategory(classification: string) {
  return post({
    url: "/category",
    data: {
      classification,
    },
  });
}
